#include "StdAfx.h"
#include "UIWindowDC.h"


CUIWindowDC::CUIWindowDC( HWND hWnd ): CUIDC( hWnd ), m_hWnd( hWnd ), m_hDC( NULL )
{
    m_hDC =::GetWindowDC( m_hWnd );
}


CUIWindowDC::~CUIWindowDC( void )
{
    ::ReleaseDC( m_hWnd, m_hDC );
}

HDC CUIWindowDC::GetDC()
{
    return m_hDC;
}

void CUIWindowDC::ExcludeClient( HWND hWnd )
{
    RECT rcWnd;
    ::GetWindowRect( hWnd, &rcWnd );
    POINT pt;
    pt.x = rcWnd.left;
    pt.y = rcWnd.top;
    ::ScreenToClient( hWnd, &pt );
    pt.x = 0 - pt.x;
    pt.y = 0 - pt.y;
    RECT rcClient;
    ::GetClientRect( hWnd, &rcClient );
    ::ExcludeClipRect( m_hDC, pt.x, pt.y, pt.x + rcClient.right, pt.y + rcClient.bottom );
}
